const http = uni.$u.http

// 获取微信sdk配置
export function wechatAuth(code, spread) {
    const reg = /^[0-9]+.?[0-9]*$/;
    spread = reg.test(spread) ? spread : 0;
    return http.post('/api/login/wechat/public', {code: code, spread: spread},{
        noAuth: true
    })
}

//登录
// export const loginApi = (data) => http.post('/api/front/login/mobile/password', data, {
// 	custom: {
// 		auth: false,
// 	}
// })

// 微信小程序登录
export const wechatLogin = (data) => http.post('/api/front/login/wechat/routine', data)

// 手机号密码 登录
export const passwordLogin = (data) => http.post('/api/front/login/mobile/password', data)

// 发送短信验证码
export const sendCode = (data) => http.post('/api/front/login/send/code', data)

// 检验token是否有效
export const tokenIsExistApi = () => http.post('/api/front/login/token/is/exist', {}, { noAuth: true })

// APP微信登录
export const appAuth = (data) => http.post('/api/front/login/wechat/app/login', data, { noAuth: true })
